/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// IAdminOperationLog interface for NHibernate mapped table 'AdminOperationLog'.
	/// </summary>
	public interface IAdminOperationLog
	{
		#region Public Properties
		
		int ol_id
		{
			get ;
			set ;
			  
		}
		
		int ol_user
		{
			get ;
			set ;
			  
		}
		
		DateTime ol_time
		{
			get ;
			set ;
			  
		}
		
		string ol_table
		{
			get ;
			set ;
			  
		}
		
		int ol_resouceId
		{
			get ;
			set ;
			  
		}
		
		string ol_action
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// AdminOperationLog object for NHibernate mapped table 'AdminOperationLog'.
	/// </summary>
	[Serializable]
	public class AdminOperationLog : ICloneable,IAdminOperationLog
	{
		#region Member Variables

		protected int _ol_id;
		protected int _ol_user;
		protected DateTime _ol_time;
		protected string _ol_table;
		protected int _ol_resouceid;
		protected string _ol_action;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public AdminOperationLog() {}
		
		public AdminOperationLog(int poluser, DateTime poltime, string poltable, int polresouceId, string polaction)
		{
			this._ol_user = poluser; 
			this._ol_time = poltime; 
			this._ol_table = poltable; 
			this._ol_resouceid = polresouceId; 
			this._ol_action = polaction; 
		}
		
		public AdminOperationLog(int polid)
		{
			this._ol_id = polid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int ol_id
		{
			get { return _ol_id; }
			set { _bIsChanged |= (_ol_id != value); _ol_id = value; }
			
		}
		
		public virtual int ol_user
		{
			get { return _ol_user; }
			set { _bIsChanged |= (_ol_user != value); _ol_user = value; }
			
		}
		
		public virtual DateTime ol_time
		{
			get { return _ol_time; }
			set { _bIsChanged |= (_ol_time != value); _ol_time = value; }
			
		}
		
		public virtual string ol_table
		{
			get { return _ol_table; }
			set 
			{
			  if (value != null && value.Length > 20)
			    throw new ArgumentOutOfRangeException("ol_table", "ol_table value, cannot contain more than 20 characters");
			  _bIsChanged |= (_ol_table != value); 
			  _ol_table = value; 
			}
			
		}
		
		public virtual int ol_resouceId
		{
			get { return _ol_resouceid; }
			set { _bIsChanged |= (_ol_resouceid != value); _ol_resouceid = value; }
			
		}
		
		public virtual string ol_action
		{
			get { return _ol_action; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("ol_action", "ol_action value, cannot contain more than 200 characters");
			  _bIsChanged |= (_ol_action != value); 
			  _ol_action = value; 
			}
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			AdminOperationLog castObj = null;
			try
			{
				castObj = (AdminOperationLog)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._ol_id == castObj.ol_id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _ol_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for AdminOperationLog 

	
	public interface IAdminOperationLogCollection : ICollection
	{
		AdminOperationLog this[int index]{	get; set; }
		void Add(AdminOperationLog pAdminOperationLog);
		void Clear();
	}
	
	[Serializable]
	public class AdminOperationLogCollection : IAdminOperationLogCollection
	{
		private IList<AdminOperationLog> _arrayInternal;

		public AdminOperationLogCollection()
		{
			_arrayInternal = new List<AdminOperationLog>();
		}
		
		public AdminOperationLogCollection( IList<AdminOperationLog> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<AdminOperationLog>();
			}
		}

		public AdminOperationLog this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((AdminOperationLog[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(AdminOperationLog pAdminOperationLog) { _arrayInternal.Add(pAdminOperationLog); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<AdminOperationLog> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
